﻿#include "hoteldetailscontent.h"
#include "ui_hoteldetailscontent.h"

HotelDetailsContent::HotelDetailsContent(QWidget *parent) :
    QWidget(parent),
    ui(new Ui::HotelDetailsContent)
{
    ui->setupUi(this);

    m_houseInfo = GlobalVars::g_localHouse;
    initWindowsUnits();
}

HotelDetailsContent::~HotelDetailsContent()
{
    delete ui;
}

void HotelDetailsContent::initWindowsUnits()
{
    ui->lb_houseType->setText(m_houseInfo.getType());
    ui->lb_area->setText("面积 " + m_houseInfo.getArea());
    ui->lb_bathroomAcc->setText("浴室配套 " + m_houseInfo.getBathroomAcc());
    ui->lb_price->setText(QString::number(m_houseInfo.getPrice()));
    ui->lb_capacity->setText("可住 " + QString::number(m_houseInfo.getCapacity()) + "人");
    ui->lb_bedType->setText("床型 " + m_houseInfo.getBedType());
    ui->lb_window->setText("窗户 " + m_houseInfo.getWindow());

    ui->lb_breakfast->setText("早餐 " + m_houseInfo.getBreakfast());
    ui->lb_media->setText("媒体设备 " + m_houseInfo.getMedia());
    ui->lb_net->setText("上网 " + m_houseInfo.getNet());
}

QString HotelDetailsContent::getType()
{
    return ui->lb_houseType->text();
}

void HotelDetailsContent::setImage(int count, const QImage &image)
{
    ui->lb_imageCount->setText(QString::number(count));
    ui->lb_image->setPixmap(QPixmap::fromImage(image.scaled(160,140)));
}

void HotelDetailsContent::on_pb_reserve_clicked()
{
    emit signalReserveHotel(m_houseInfo);
}
